export{}



//1 抽象类是普通类的描述，指定一个类的规范，给铍铜的类去继承
//2 继承之后，普通类里面就必须定义抽象类里面的抽象属性和抽象方法

// 抽象类的写法 abstract

abstract class Animal{
    public abstract name:string
    public abstract age:number
    public abstract eat():void
}

//继承之后，普通类里面就必须定义抽象类里面的抽象属性和抽象方法
class Cat extends Animal{
    public name:string = 'tom'
    public age:number = 3
    public eat():void{
        console.log('吃鱼')
    }
}

let cat = new Cat()
console.log(cat.name)
console.log(cat.age)
cat.eat()


//3 抽象类不能被实例化
// let p1=new Animal()//报错

// 书写接口给类使用 使用implements

interface AnimalInterface{
    name:string
    age:number
    eat():void
}

class Cat2 implements AnimalInterface{
    public name:string = 'tom'
    public age:number = 3
    public eat():void{
        console.log('吃鱼')
    }
}
let cat2 = new Cat2()
console.log(cat2.name)
console.log(cat2.age)
